public class D237 {
	public static boolean primeDetermine(int n) {
		if(n == 1)
			{ return false; }
		else if(n == 2 || n == 3)
			{ return true; }
		else if((n % 2) == 0)
			{ return false; }
		else {
			int end = (int)Math.pow(n, 0.5);
			for(int start = 3; start <= end; start += 2) {
				if((n % start) == 0)
					{ return false; }
			}
			return true;
		}
	}
	public static void main(String args[]) {
		Long sum = 0L;
		for(int i = 1; i < 2000000; i++) {
			if(primeDetermine(i))
				{ sum += i; }
		}
		
		System.out.println(Long.toString(sum));
	} // main
}